package com.yikome.promotion.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.yikome.common.CommonRepository;
import com.yikome.promotion.entity.Coupon;

@Repository
public interface CouponRepository extends CommonRepository<Coupon, Long> {

	@Query("select t from Coupon t where t.yn = 1 and t.id = :promotionId")
	Coupon findCoupon(@Param("promotionId")Long promotionId);
	
	@Query("select t from Coupon t where t.yn = 1 and t.promotionCode = :promotionCode")
	Coupon findCoupon(@Param("promotionCode")String promotionCode);
	
}
